home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / PPCExamples / CExamples / PPC-68K / WrapperTable.h < prev   
Encoding:
C/C++ Source or Header  |  1998-12-03  |  1.5 KB  |  59 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        WrapperTable.h
  3.  
  4.     Contains:    Table of code pointers which will correspond with the functions exported
  5.                 from the 68K library
  6.                 Part of the "calling 68K code from PowerPC" demo
  7.  
  8.     Written by:    Richard Clark
  9.  
  10.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  11.  
  12.     Change History (most recent first):
  13.  
  14.                  2/15/94    RC        Released
  15.  
  16.     To Do:
  17. */
  18.  
  19.  
  20. #include <ConditionalMacros.h>
  21. #include <MixedMode.h>
  22.  
  23. typedef pascal short (*MyRoutineProcPtr)(long);
  24.  
  25. enum {
  26.     uppMyRoutineProcInfo = kPascalStackBased
  27.          | RESULT_SIZE (SIZE_CODE(sizeof(short)))
  28.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  29. };
  30.  
  31. #if TARGET_RT_MAC_CFM
  32. // Use these definitions if we're compiling for Power Macintosh or another
  33. // Macintosh system which supports Mixed Mode
  34. typedef UniversalProcPtr MyRoutineUPP;
  35.  
  36. #define CallMyRoutineProc(userRoutine, longValue)        \
  37.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMyRoutineProcInfo, \
  38.                           longValue)
  39. #define NewMyRoutineProc(userRoutine)        \
  40.         (MyRoutineUPP) NewRoutineDescriptor((ProcPtr)userRoutine, \
  41.                        uppMyRoutineProcInfo, GetCurrentISA())
  42. #else
  43. // Use these definitions if we're compiling for a 68K-based Macintosh
  44. typedef MyRoutineProcPtr MyRoutineUPP;
  45.  
  46. #define CallMyRoutineProc(userRoutine, longValue)        \
  47.         (*(userRoutine))(longValue)
  48. #define NewMyRoutineProc(userRoutine)        \
  49.         (MyRoutineUPP)(userRoutine)
  50. #endif
  51.  
  52.     
  53. // Here's the list of Universal Procedure Pointers
  54. struct JumpTable {
  55.     MyRoutineUPP    routine1;
  56. };
  57.  
  58. typedef struct JumpTable JumpTable, *JumpTablePtr;
  59.